﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Diagnostics;
using System.IO;

namespace YourWorld.Web
{
    [ServiceContract( Namespace = "" )]
    [AspNetCompatibilityRequirements( RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed )]
    public class InitializeServersService
    {
        private bool isServerStarted = false;
        private bool isServerStartRequested = false;

        [OperationContract]
        public void Initialize()
        {
            return;

            //if ( isServerStarted == true )
            //    return;

            //if ( isServerStartRequested == true )
            //    return;

            //try
            //{
            //    this.isServerStartRequested = true;

            //    string pathAppFolder = Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "App_Data" );
            //    // string policyServerFileName = "PolicyServer.exe";
            //    string socketsServerFileName = "YourWorldServer.exe";

            //    Process.Start( Path.Combine( pathAppFolder, socketsServerFileName ) );
            //    // Process.Start( Path.Combine( pathAppFolder, policyServerFileName ) );

            //    this.isServerStarted = true;
            //}
            //catch
            //{
            //    this.isServerStarted = false;
            //    this.isServerStartRequested = false;
            //}
        }
    }
}
